-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send keypresses when a text input is submitted (Linux only) #36
base: master
Are you sure you want to change the base?
Conversation
@@ -27,7 +30,7 @@ import Monpad | |||
import Orphans.Evdev () | |||
|
|||
type E = Map LayoutID (Device, LayoutMeta) | |||
type S = (Device, LayoutMeta) | |||
type S = ((Device, LayoutMeta), Text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a record.
'7' -> Just Key7 | ||
'8' -> Just Key8 | ||
'9' -> Just Key9 | ||
'a' -> Just KeyA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle capitals by inserting KeyShift
?
@@ -87,6 +96,18 @@ conf = ServerConfig | |||
lookup' #stickMap i \(x', y') -> onAxis x x' <> onAxis y y' | |||
ClientUpdate (SliderMove i x) -> | |||
lookup' #sliderMap i . onAxis $ x * 2 - 1 | |||
ClientUpdate (InputText _ t) -> do | |||
(#extra % _2) .= t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should track each text input element separately. In fact, really the frontend should track this state anyway - see #35.
_ -> Nothing | ||
|
||
keyToChar :: Key -> Maybe Char | ||
keyToChar = \case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DRY this with the above. Maybe by constructing a top level list of pairs, and two maps.
@@ -159,3 +180,107 @@ data Axis | |||
|
|||
keyUnknown :: Key | |||
keyUnknown = KeyUnknown | |||
|
|||
charToKey :: Char -> Maybe Key | |||
charToKey = \case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably incomplete. Complete it and maybe upstream to evdev
?
This needs some cleaning up.